package com.cysyz.mylib.excel.validator.impl;

import com.cysyz.mylib.excel.validator.FileNameValidator;

public class FileNameValidatorImplExtensionCheck implements FileNameValidator{
	
	private String extension;
	private String errorMessage;
	
	public FileNameValidatorImplExtensionCheck(String extension, String errorMessage) {
		this.extension = extension;
		this.errorMessage = errorMessage;
	}
	@Override
	public String fileNameValidate(String fileName) {
		if (fileName.lastIndexOf(extension) < 0) {
			return this.errorMessage;
		}
		return null;
	}

}
